package com.example.designpattern.factory.simpleFactoryDesign;

/**
 * @program: DesignPattern
 * @description: 简单工厂
 * @author: zhangjt
 * @create: 2024-11-15 17:09
 **/
public class SimpleFactory {
    public Resource createResource(String type) {
        Resource resource = null;
        if ("mysql".equals(type)) {
            resource = new MysqlResource();
        } else if ("redis".equals(type)) {
            resource = new RedisResource();
        }
        return resource;
    }
}
